package com.hd.appcommon.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hd.appcommon.entity.Teacher;
import com.hd.appcommon.entity.User;
import com.hd.appcommon.entity.vo.StudentVo;
import com.hd.hdxgddcommon.page.MyPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Select(" select m.* from user m " +
            " inner join org_member_role mr " +
            " on  CONCAT(m.id, '') = mr.org_member_id " +
            " where mr.role_id = #{roleId} ")
    List<User> listByRoleId(@Param("roleId") String roleId);

    @Select("SELECT u.name,u.phone,u.job_number, u.gender,s.school_class as schoolClass,s.major_id as majorId,s.credit as credit" +
            " FROM user u,student s " +
            "where u.ddid=s.user_id and u.type=1 ${ew.customSqlSegment}")
    IPage<StudentVo> listStuMessage(MyPage page,@Param("ew") QueryWrapper<User> queryWrapper);
}
